import { ROAST_CONFIG } from "../config";

export default {
    //获取用户数据
    getUser:function () {
        return axios.get(ROAST_CONFIG.API_URL+'/my');
    },
    //登录
    login:function (account,password) {
        return axios.get(ROAST_CONFIG.API_URL+'/login',{
            params:{
                account:account,
                password:password,
            }
        });
    },
    //注销
    logout:function(){
      return axios.get(ROAST_CONFIG.API_URL+'/logout')
    },
    //注册
    register:function (registerData) {
      return axios.post(ROAST_CONFIG.API_URL+'/register',{
          name:registerData.name,
          account:registerData.account,
          email:registerData.email,
          password:registerData.password,
          password_confirmation: registerData.password_confirmation
      });
    },
    //更新用户信息
    updateProfile:function (profile) {
        return axios.put(ROAST_CONFIG.API_URL+'/user',profile)
    }
}
